module.exports = {
	$(s) {
		let nodeList = document.querySelectorAll(s);
		if (nodeList.length === 0) {
			return console.warn(`${s},你节点呢`);
		}
		if (nodeList.length === 1) {
			return nodeList[0];
		}
		if (nodeList.length > 1) {
			return nodeList;
		}
	},

	// 底部导航栏
	tabber(filename) {
		let html = `
		<a href="index.html" class="${
			filename === "index" ? "active" : ""
		}"><i class="iconfont icon-shouye"></i>首页</a>
		<a href="sports_course.html" class="${
			filename === "sports_course" ? "active" : ""
		}"><i class="iconfont icon-24gl-heartPulse"></i>运动</a>
		<a href="mine.html" class="${
			filename === "mine" ? "active" : ""
		}"> <i class="iconfont icon-wode"></i>我的 </a>
		`;

		this.$(".tabber").innerHTML = html;
	},

	navbar(filename) {
		let html = `
			<a href="sports_run.html" class="${
				filename === "sports_run" ? "active" : ""
			}">跑步</a>
			<a href="sports_cycling.html" class="${
				filename === "sports_cycling" ? "active" : ""
			}">骑行</a>
			<a href="sports_course.html" class="${
				filename === "sports_course" ? "active" : ""
			}">课程训练</a>
		`;
		this.$(".navbar").innerHTML = html;
	},
};
